const Koa = require('koa');
const app = new Koa();

app.dbconfig = {};

app.use(async(ctx, next) => {
    await next();
    const rt = ctx.response.get("X-response-Time")
    console.log(`${ctx.method} ${ctx.url} ${ctx.status} ${rt}`);  
})

app.use(async (ctx, next) => {
    const start = Date.now();
    await next();
    const ms = Date.now() - start
    ctx.set("X-response-Time", `${ms} ms`);
})


app.use(async (ctx) => {
    ctx.body = " Hello Word";
})

app.listen(3000)